package com.alibaba.zihao.service;

import com.alibaba.zihao.domain.config;

import java.io.*;

/**
 * Created by jason on 3/14/15.
 */
public class ZihaoRead {

    private String str = "";
    private StringBuilder sb = new StringBuilder();

    public String readLine(){

        try {
            BufferedReader br = new BufferedReader(new FileReader(config.localFileOut));
            str = br.readLine();
            br.close();
        } catch (FileNotFoundException e1) {
            e1.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
    }
    public StringBuilder read(){

        try {
            File file = new File(config.localFileOut);
            BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(file)));

            while ((str = br.readLine())!=null)
            {
                if (str.equals("tile+++++++++++++++++++++++++++++++++++++++"))
                sb.append(str);
            }
            br.close();
        } catch (FileNotFoundException e1) {
            e1.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return sb;
    }
}
